package com.ldc.common.net;

import android.util.Log;

import androidx.annotation.NonNull;

import okhttp3.logging.HttpLoggingInterceptor;

public class RequestLogging implements HttpLoggingInterceptor.Logger {
    private static final String TAG = "RequestLogging";

    public static HttpLoggingInterceptor getLogger(HttpLoggingInterceptor.Level level) {
        return new HttpLoggingInterceptor(new RequestLogging()).setLevel(level);
    }

    public static HttpLoggingInterceptor getLogger() {
        return getLogger(HttpLoggingInterceptor.Level.BODY);
    }

    @Override
    public void log(@NonNull String message) {
        Log.e(TAG, String.format("网络日志: %s", message));
    }
}
